<?php
$mu = Session::get('mu');
$u = new Model('qy_agency_thirdappsetting');
$u->find(['pid'=>$mu->id]);
if($u->try_post()){
	if(!$u->id){
		$u->pid = $mu->id;
		$u->ctime = date('Y-m-d H:i:s');
	}
	$u->save();
	tusi('设置成功');
}
$zlUlr = getHost();
$commonUrl = getCommonUrl();
$getVerify = getVerify();
function getHost() {
  return getHttp() . '://' . $_SERVER['HTTP_HOST'] . '/Addons/QyWechat/Api/Providers/ZlCallback.html';
}
function getCommonUrl() {
  return getHttp() . '://' . $_SERVER['HTTP_HOST'] . '/Addons/QyWechat/Api/Providers/CommonCallback.html';
}
function getVerify() {
  return getHttp() . '://' . $_SERVER['HTTP_HOST'] . '/Addons/QyWechat/Api/Providers/Verify.html';
}
function getHttp() {
  if (strtolower(explode('://', $_SERVER['HTTP_REFERER'])[0]) == 'https') {
    return 'https';
  }
  if (strtolower($_SERVER['REQUEST_SCHEME']) == 'https') {
    return 'https';
  }
  return 'http';
}